<!DOCTYPE HTML>  
<HTML>  
<HEAD>  
<TITLE>  Detect Caps Lock </TITLE>  
<script>  
  /*  
 javascript��keyCode�����Ӧ�� 
 event.keyCode=32        �ո� 
 event.keyCode=13        �س� 
 event.keyCode=27        Esc 
 event.keyCode=16)        Shift 
 event.keyCode=17)        Ctrl 
 event.keyCode=18)        Alt 
  */  
function  detectCapsLock(e){ 
   var key = e.keyCode ? e.keyCode : e.which; // CapsLock���Ƿ��  
   var shift  =  e.shiftKey ? e.shiftKey : (key == 16  ? true : false ); // shift���Ƿ�ס 

    if (((key>=65 && key<=90) && !shift) || // CapsLock�򿪣�����shift��û�а�ס  
		((key>=97 && key<=122) && shift)){  // Caps Lock �򿪣����Ұ�ס shift�� 
	     document.getElementById('capStatus').style.visibility  =  'visible'; 
	}else{
		 document.getElementById('capStatus').style.visibility  =  'hidden'; 
	}

} 
</script>  
</HEAD>  

<BODY>  
<input  type ="password"  name ="pwd"  onkeypress ="detectCapsLock(event)"   />  
<div  id ="capStatus"  style ="visibility:hidden"><font  color =red> Caps Lock is on. <font></div>  
</BODY>  
</HTML> 